package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class FileDemo02 {
    public static void main(String[] args) throws IOException {
        try(InputStream f = new FileInputStream("hello.txt")){
            byte[] buf = new byte[1024];
            int len;

            while(true){
                len=f.read(buf);
                if(len==-1){
                    break;
                }
                for (int i = 0; i < len; i++) {
                    System.out.printf("%c",buf[i]);
                }
            }

        }
    }
}
